<?php

namespace app\api\controller\minishop;

use app\common\controller\Api;
use app\admin\model\minishop\Banner as BannerModel;
use think\Db;

/**
 * 首页接口
 */
class Banner extends Api
{
    // 无需登录的接口,*表示全部
    protected $noNeedLogin = ['*'];
    // 无需鉴权的接口,*表示全部
    protected $noNeedRight = ['*'];
    
    public function getBanners()
    {
        // 从数据库读取数据
        $banners = BannerModel::select();
        
        foreach($banners as &$v){
            $v['image'] = $this->request->domain().$v['image'];
        }
        
        // 返回成功响应
        $this->success('请求成功', $banners);
    }
}